WebWork 2 : Accessing application, session, request objects
This page last changed on Nov 30, 2004 by jcarreira.
Webwork provides several access helpers to access Session, Application, Request scopes. Map session = (Map) ActionContext.getContext().get("session"); session.put("myId",myProp); ServletActionContext.getRequest().getSession() Note: Be sure not to use ActionContext.getContext() in the constructor of your action since the values may not be set up already (returning null for getSession()). In your views, you can access with your jsps as such <ww: property value="#session.myId" /> <ww: property value="#request.myId" /> Map request = (Map) ActionContext.getContext().get("request"); request.put("myId",myProp); Map application = (Map) ActionContext.getContext().get("application"); application.put("myId",myProp); Map session = (Map) ActionContext.getContext().get("attr"); attr.put("myId",myProp); The 'attr' map will search the javax.servlet.jsp.PageContext for the specified key. If the PageContext dosen't exist, it will search request,session,application maps respectively. |
Document generated by Confluence on Dec 14, 2004 16:36 |